package cn.ytnet.shangyun.service.basic.service.impl;

import cn.ytnet.shangyun.service.basic.dao.ProvinceDAO;
import cn.ytnet.shangyun.service.basic.entity.ProvinceEntity;
import cn.ytnet.shangyun.service.basic.service.ProvinceService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by cyongk on 2015/12/8.
 */

@Service("provinceServiceImpl")
public class ProvinceServiceImpl implements ProvinceService {

    @Resource
    private ProvinceDAO provinceDAOImpl;

    //查询全部
    @Transactional(readOnly = true, propagation = Propagation.REQUIRED)
    public List<ProvinceEntity> findAllProvince() {
        List<ProvinceEntity> allProvince = provinceDAOImpl.findAllProvince();
        return allProvince;
    }

    //单个查询
    @Transactional(readOnly = true, propagation = Propagation.REQUIRED)
    public ProvinceEntity getProvince(String id) {
        return null;
    }

    //按关键字查询
    @Transactional(readOnly = true, propagation = Propagation.REQUIRED)
    public List<ProvinceEntity> getStringProvince(String id) {
        return null;
    }

    //单个保存
    @Transactional(propagation = Propagation.REQUIRED)
    public void saveProvince(ProvinceEntity provinceEntity) {
        provinceDAOImpl.saveProvince(provinceEntity);
    }

    //单个更新（修改）
    @Transactional(propagation = Propagation.REQUIRED)
    public void updateProvince(String id, ProvinceEntity provinceEntity) {
        provinceDAOImpl.updateProvince(id,provinceEntity);
    }

    //单个删除
    @Transactional(propagation = Propagation.REQUIRED)
    public boolean deleteProvince(String id) {
        return true;
    }


}
